package com.ds.shopping_admin_service.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ds.shopping_common.pojo.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface RoleMapper extends BaseMapper<Role> {
    //根据id查询角色，包括权限
    Role findById(@Param("rid") Long rid);

    //删除角色的所有权限
    @Delete("delete from bz_role_permission where rid=#{rid}")
    int deletePermissionAllRole(@Param("rid") Long rid);

    //给角色添加权限
    @Insert("insert into bz_role_permission values (#{rid},#{pid})")
    int addPermissionToRole(@Param("rid")Long rid,@Param("pid") Long pid);


}
